import { BlankTipItem } from "../../common/tooltip/BlankTipItem";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
import { PetMingItemData } from "../info/PetMingItemData";
import { ItemsUtil } from "../../shortcuts/item/ItemsUtil";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GImageBitmap } from "../../../../../com/mui/controls/GImageBitmap";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
type int = number;
//class PetMingScoreItem
    
    export  class PetMingScoreItem extends BlankTipItem
    {
        constructor()
        {
            super(95, 25, 0, 0);
            this.init();
            ToolTipsManager.register(this);
            return;
        }

        public set score(arg1: int)
        {
            this._scoreTxt.text = arg1.toString();
            return;
        }

        public set itemDatas(arg1: Array<any>)
        {
            var loc1=null;
            this._totalScore = 0;
            this._itemDatas = arg1;
            var loc2=0;
            while (loc2 < this._itemDatas.length) 
            {
                loc1 = this._itemDatas[loc2];
                if (loc1) 
                {
                    this._totalScore = this._totalScore + loc1.score;
                }
                ++loc2;
            }
            this.score = this._totalScore;
            return;
        }

        public set playerItems(arg1: Array<any>)
        {
            var loc2=null;
            this._playerItems = arg1;
            var loc1=[];
            var loc3=0;
            while (loc3 < arg1.length) 
            {
                loc2 = arg1[loc3];
                loc1.push(new PetMingItemData(loc2));
                ++loc3;
            }
            this.itemDatas = loc1;
            return;
        }

        public /* override */ get toolTipData()
        {
            var loc1=null;
            var loc2=null;
            var loc4=0;
            var loc3="";
            this._totalScore = 0;
            if (this._itemDatas) 
            {
                loc4 = 0;
                while (loc4 < this._itemDatas.length) 
                {
                    loc2 = this._itemDatas[loc4];
                    if (loc2) 
                    {
                        this._totalScore = this._totalScore + loc2.score;
                        loc3 = loc3 + ("\n" + ItemsUtil.getItemName(loc2) + "    Lv" + loc2.itemExInfo.ls_level + "   " + loc2.getAttrDesc("  "));
                    }
                    ++loc4;
                }
            }
            if (this._totalScore == 0) 
            {
                loc3 = Language.getString(54779);
            }
            loc1 = Language.getStringByParam(54753, this._totalScore) + loc3;
            return "<textFormat leading=\'5\'>" + loc1 + "</textFormat>";
        }

        /* internal  */init(): void
        {
            ObjCreate.createBg(0, 0, 95, 25, this, ImagesConst.DisabledBg);
            this.addChild(new GImageBitmap("PetMingScoreIcon.png"));
            this._scoreTxt = ObjCreate.createGTextField("0", 35, 5, 60, 25, this, GlobalStyle.textFormatOrange);
            this._scoreTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._scoreTxt.mouseEnabled = false;
            return;
        }

        /* internal */ /* var */_scoreTxt: GTextFiled;

        /* internal */ /* var */_totalScore: int;

        /* internal */ /* var */_playerItems: Array<any>;

        /* internal */ /* var */_itemDatas: Array<any>;
    }
